package io.litchi.auth.domain.factory;

import io.litchi.auth.Infrastructure.common.command.user.SaveUserCommand;
import io.litchi.auth.Infrastructure.common.result.user.UserDetailResult;
import io.litchi.auth.Infrastructure.common.result.user.UserListResult;
import io.litchi.auth.domain.entity.auth.User;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import static org.mapstruct.MappingConstants.ComponentModel.SPRING;
import static org.mapstruct.NullValueCheckStrategy.ALWAYS;
import static org.mapstruct.NullValuePropertyMappingStrategy.IGNORE;

/**
 *
 *
 * @author helang
 * @since 2025-11-14
 */
@Mapper(nullValuePropertyMappingStrategy = IGNORE, nullValueCheckStrategy = ALWAYS,
        unmappedSourcePolicy = ReportingPolicy.IGNORE, unmappedTargetPolicy = ReportingPolicy.IGNORE, componentModel = SPRING)
public interface UserFactory {
    UserFactory INSTANCE = Mappers.getMapper(UserFactory.class);
    
    UserListResult mapToUserListResult(User user);

    UserDetailResult mapToUserDetail(User user);

    User mapToUserEntity(SaveUserCommand command);
}